//package com.le.tester.concurrentchallenge.executorSelf;
//
//import com.sun.scenario.effect.ImageData;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.ExecutionException;
//import java.util.concurrent.Executor;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//
///**
// * createTime：2025-03-31 10:10
// * description：使用Future等待图像下载
// */
//public class FutureRender {
//    private final ExecutorService executorService = Executors.newCachedThreadPool();
//
//    void readerPage(CharSequence sour) {
//        final List<ImageInfo> imageInfos = scanImageInfo(sour);
//
//        Callable<List<ImageData>> task = () -> {
//            List<ImageData> result = new ArrayList<>();
//            for (ImageInfo iiItem : imageInfos) {
//                result.add(iiItem.downLoadImage());
//            }
//            return result;
//        };
//        Future<List<ImageData>> future = executorService.submit(task);
//        renderText(sour);
//
//        try {
//            List<ImageData> imageData = future.get();
//            for (ImageData idItem : imageData) {
//                renderImage(idItem);
//            }
//        } catch (InterruptedException e) {
//            Thread.currentThread().interrupt();
//            future.cancel(true);
//        } catch (ExecutionException e) {
//            throw new RuntimeException(e);
//        }
//
//    }
//}
